package com.itheima.service.Impl;

import com.github.pagehelper.PageHelper;
import com.itheima.dao.IOrdersDao;
import com.itheima.domian.Orders;
import com.itheima.service.IOrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class OrdersServiceImpl  implements IOrdersService {

    @Autowired
    private IOrdersDao  iOrdersDao;

    @Override
    public List<Orders> findAll(int page, int size) throws Exception {
//        参数pageNum是页码值，参数pageSize每一页显示条数
        PageHelper.startPage(page,size);
        return iOrdersDao.findAll();
    }

    @Override
    public Orders findById(String id) throws Exception {
        return iOrdersDao.findByid(id);
    }
}
